<%@ page contentType="text/html; charset=ISO-8859-1"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.*"%>
<%
/*
 * This software is provided under the terms
 * of GNU Lesser GPL License. You may not use
 * this file except in compliance with the license. If you need a copy of the license,
 * please go to http://www.gnu.org/copyleft/lesser.html. 
 
 * @author Fabio D'Ovidio
 * @author Matteo Villari
 
*/

String server = request.getParameter("server");
String layername = request.getParameter("layer");
String wfsUrl = "http://" + server + "/geoserver/wfs?request=GetFeature&typename=topp:"+ layername + "&outputformat=json&version=1.0.0";
String result = null;
    try
    {
    	URL url = new URL(wfsUrl);
        URLConnection conn = url.openConnection ();
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        StringBuffer sb = new StringBuffer();
        String line;
        while ((line = rd.readLine()) != null)
        {
        sb.append(line);        
        }
        rd.close();
        result = sb.toString();
        } catch (Exception e)
      {
      e.printStackTrace();
      }

out.println(result);

%>
